package view;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTable;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class CustomersListView  extends javax.swing.JPanel
{
	private JTable tableCustomers;
	private JButton btnDelete;
	private JButton btnEdit;
	private JPanel panelButtons;

	/**
	* Auto-generated main method to display this 
	* JPanel inside a new JFrame.
	*/
		
	public CustomersListView() {
		super();
		initGUI();
	}
	
	public void addActionListener(ActionListener al){
		btnDelete.addActionListener(al);
		btnEdit.addActionListener(al);
	}
	
	private void initGUI() {
		try {
			BorderLayout thisLayout = new BorderLayout();
			this.setLayout(thisLayout);
			this.setSize(new java.awt.Dimension(409, 300));
			{
				tableCustomers = new JTable();
				BorderLayout tableCustomersLayout = new BorderLayout();
				tableCustomers.setLayout(tableCustomersLayout);
				this.add(tableCustomers, BorderLayout.CENTER);
				tableCustomers.setPreferredSize(new java.awt.Dimension(409, 243));
				tableCustomers.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
				this.add(tableCustomers.getTableHeader(), BorderLayout.PAGE_START);
			}
			{
				panelButtons = new JPanel();
				GridLayout panelButtonsLayout = new GridLayout(1, 1);
				panelButtonsLayout.setColumns(1);
				panelButtonsLayout.setHgap(5);
				panelButtonsLayout.setVgap(5);
				panelButtons.setLayout(panelButtonsLayout);
				this.add(panelButtons, BorderLayout.SOUTH);
				panelButtons.setPreferredSize(new java.awt.Dimension(409, 24));
				{
					btnEdit = new JButton();
					panelButtons.add(btnEdit);
					btnEdit.setText("Edit Selected");
				}
				{
					btnDelete = new JButton();
					panelButtons.add(btnDelete);
					btnDelete.setText("Delete Selected");
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public JTable getTableCustomer() {
		return tableCustomers;
	}

	public JButton getBtnDelete()
	{
		return btnDelete;
	}

	public JButton getBtnEdit()
	{
		return btnEdit;
	}
	
	

}
